def output_line(num):
    line_str = '_' * num
    print(line_str)


def default_line():
    line_str = '_' * 20
    print(line_str)


try:
    while 1:
        cmd = input('1:默认输出\n2:自定义输出\n3:退出请\n输入您所需要的功能:')
        if cmd == '1':
            default_line()
        elif cmd == '2':
            line_num = int(input('输入输出的横线数量:'))
            if type(line_num) != type(1):
                print('输入不是数字！！')
                break
            else:
                output_line(line_num)
        elif cmd == '3':
            break
        else:
            print('输入错误\n')
            break
except KeyboardInterrupt:
    print("\n用户未输入,bye!!!")
except ValueError:
    print('\n输入错误')
